FROM registry.cn-hangzhou.aliyuncs.com/acs/maven:3-jdk-8 AS build-env
ENV MY_HOME=/app
RUN mkdir -p $MY_HOME
WORKDIR $MY_HOME
ADD . $MY_HOME
RUN ["/usr/local/bin/mvn-entrypoint.sh", "mvn", "clean", "package", "-X", "-Dmaven.test.skip=true"]

FROM openjdk:8-jre-alpine
ENV MY_HOME=/app
RUN mkdir -p $MY_HOME
WORKDIR $MY_HOME
COPY --from=build-env $MY_HOME/target/*.jar $MY_HOME/app.jar
ADD run.sh run.sh
RUN chmod a+x run.sh
